package com.five.pojo.dto;

import com.five.pojo.entity.OrderItem;
import lombok.Data;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

@Data
public class OrderCreateDto implements Serializable {
    private Long userId;  // 隐藏前端传递，由后端填充

    @NotEmpty(message = "订单项不能为空")
    private String address;

    @NotNull(message = "订单总金额不能为空")
    @DecimalMin(value = "0.01", message = "订单总金额必须大于0")
    private BigDecimal totalAmount;

    @NotEmpty(message = "订单项不能为空")  // 集合非空校验
    private List<OrderItem> orderItems;  // 订单项列表（替代原String类型）

    private String receiverName;

    private String receiverPhone;

    private List<String> carIds;

}